﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using Ooaavee.Scripting;
using Ooaavee.TestTools;

namespace UnitTests.Ooaavee.Scripting
{
    /// <summary>
    /// Tests Code class.
    /// </summary>
    [TestClass]
    public class CodeTest : TestBase
    {
        /// <summary>
        /// Tests GetCode method.
        /// Language is C#.
        /// </summary>
        [TestMethod]
        public void GetCodeTest1()
        {
            Code_Accessor code = Code_Accessor.GetCode("return null;", "X", new References(), Language.CSharp);

            Assert.IsNotNull(code, "code");
            Assert.IsNotNull(code.FullSourceCode, "FullSourceCode");
            Assert.IsNotNull(code.Namespace, "Namespace");
            Assert.IsNotNull(code.Class, "Class");
            Assert.IsNotNull(code.Method, "Method");
        }

        /// <summary>
        /// Tests GetCode method.
        /// Language is Visual Basic.
        /// </summary>
        [TestMethod]
        public void GetCodeTest2()
        {
            Code_Accessor code = Code_Accessor.GetCode("Return Nothing", "X", new References(), Language.VisualBasic);

            Assert.IsNotNull(code, "code");
            Assert.IsNotNull(code.FullSourceCode, "FullSourceCode");
            Assert.IsNotNull(code.Namespace, "Namespace");
            Assert.IsNotNull(code.Class, "Class");
            Assert.IsNotNull(code.Method, "Method");
        }
    }
}
